import request from '@/common/request'
import Qs from 'qs';
import config from '@/config/env'
import requestPlat from '@/common/requestPlat';
// 账号操作
export function accountUser(params) {
    return requestPlat({
        url: `member/data/login/code`,
        method: 'post',
        params
    })
}

// 获取员工加入的公司列表
export function companyList(params) {
    return request({
        url: `user/company/list`,
        method: 'get',
        params
    })
}
// 切换公司
// export function switchCompany(data) {
//     return request({
//         url: `user/user/switch?profileId=${data}`,
//         method: 'post',
//     })
// }

// 切换公司
export function switchCompanyLogin(params) {
    return request({
        url: `user/data/login/switch`,
        method: 'post',
		params
    })
}

// 密码登录
export function loginPass(data) {
    return requestPlat({
        url: `member/data/login/pass`,
        method: 'post',
        data: Qs.stringify(data)
    })
}
// 自动登录
export function loginOpenId(data) {
    return requestPlat({
        url: `user/data/login/openId`,
        method: 'post',
        data: Qs.stringify(data)
    })
}
// 退出登录
export function logout(data) {
    return requestPlat({
        url: `user/data/logout`,
        method: 'post',
        data: Qs.stringify(data)
    })
}
// 找回密码
export function findPass(data) {
    return requestPlat({
        url: `user/data/find/pass`,
        method: 'post',
        data: Qs.stringify(data)
    })
}

// 注册
export function reg(params) {
	params.mchId = config.mchId
    return requestPlat({
        url: `user/data/reg`,
        method: 'post',
        params
    })
}

// 操作日志
export function pageLog(params) {
    return request({
        url: `user/user/log/page/${params.page}/${params.limit}`,
        method: 'get',
        params
    })
}


// 获取openID
export function wxOpenId(params) {
	params.mchId = config.mchId
    return requestCompany({
        url: `common/data/get_openid_session`,
        method: 'get',
        params
    })
}

// 微信登录
export function wxLogin(params) {
    return request({
        url: `user/data/login/automatic`,
        method: 'get',
        params
    })
}


// 微信获取手机号登录
export function getPhoneNumber(params) {
	params.mchId = config.mchId
    return requestPlat({
        url: `common/data/getPhoneNumber`,
        method: 'get',
        params
    })
}


// 获取是否展示社区
export function getVersion(params) {
    return request({
        url: `system/data/util/server/version`,
        method: 'get',
        params
    })
}